/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.data;

import javax.microedition.location.Location;
import org.kalmeo.kuix.core.model.DataProvider;

/**
 *
 * @author Marnix Renne
 */
public class LocationDataProvider extends DataProvider {
    private static final String LOCATION_PROPERTY = "location";
    private static final String PROGRESS_PROPERTY = "progress";
    private Location location;
    private int progress;
    
    public void setLocation(Location location) {
        this.location = location;
        dispatchUpdateEvent(LOCATION_PROPERTY);
    }
    
    public void setProgress(int progress) {
        this.progress = progress;
        dispatchUpdateEvent(PROGRESS_PROPERTY);
    }
    
    public Object getUserDefinedValue(String property) {
        if(LOCATION_PROPERTY.equals(property)) {
            return location;
        }
        if(PROGRESS_PROPERTY.equals(property)) {
            return String.valueOf(progress);
        }
        return null;
    }
}
